// 引入koa-router
const Router = require('koa2-router');
const router = new Router();
// 引入path模块
const path = require('path');
// 处理上传图片的模块
const multer = require('@koa/multer');
// 定义上传图片的文件夹
const uploadHome = multer({ dest: path.join(__dirname, "../../public/images/home/") });

// login路由
const login = require("../../controller/admin/login");
// 图片上传路由
const upload = require("../../controller/admin/upload");
// banner路由
const banner = require("../../controller/admin/banner");
// users路由
const users = require("../../controller/admin/users");
// goods路由
const goods = require("../../controller/admin/goods");
// parts路由
const parts = require("../../controller/admin/parts");

// login路由
router.use("/login", login);
// 图片上传路由
router.use("/upload",uploadHome.single("img"),upload);
// banner路由
router.use("/banner", uploadHome.single("img"),banner);
// users路由
router.use("/users", users);
// goods路由
router.use("/goods", goods);
// parts路由
router.use("/parts", parts);

module.exports = router;
